﻿using System;
using System.ComponentModel.DataAnnotations;

namespace BabyShop.Site.Models
{
    [Table("Products")]
    public class Product
    {
        [Key]
        public Guid ProductGuid { get; set; }

        [Display(Name = "商品编号")]
        [Required]
        [MinLength(8), MaxLength(15)]
        public string ProductCode { get; set; }

        [Display(Name = "商品类型")]
        public Guid ProductTypeGuid { get; set; }

        [Display(Name = "商品名称")]
        [MaxLength(25)]
        [Required(AllowEmptyStrings = false)]
        public string ProductName { get; set; }

        [Display(Name = "商品标题")]
        [Required(AllowEmptyStrings = false)]
        [MaxLength(250)]
        public string ProductTitle { get; set; }

        [Display(Name = "商品价格")]
        [Required]
        public decimal Price { get; set; }

        [Display(Name = "商品简介")]
        public string ProductIntro { get; set; }

        [Required(AllowEmptyStrings = false)]
        [Display(Name = "封面照片")]
        public string ProductPhoto { get; set; }

        public CommonColumns CommonColumns { get; set; }

        [ForeignKey("ProductTypeGuid")]
        public ProductType ProductType { get; set; }
    }
}